#include <iostream>
#include <memory>
#include <vector>

#include "modbus_serial_port.h"
#include "serial_port.h"
int main(int argc, char* argv[]) {
  // 1. 初始化串口配置
  SerialConfig config;
  config.baut_rate = 9600;
  config.data_bits = DataBits::EIGHT;
  config.stop_bits = StopBits::ONE;
  config.parity = Parity::NONE;
  config.flow_control = FlowControl::NONE;
  std::string name = argv[1];
  // 2. 创建串口对象
  SerialPort serial(name, config);
  std::cout << "主站：串口打开成功" << std::endl;

  // 3. 创建 Modbus 主站对象
  std::shared_ptr<ModbusBase> modbus_master =
      std::make_shared<ModbusMaster>(serial, 5000, 256);

  modbus_master->Start();
  return 0;
}